package com.mo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@FeignClient("nacos-provider") //服务名称
interface ConsumerHttpApi{

    @GetMapping("/provider/echo/{string}")
    public String doecho(@PathVariable(value ="string") String string);

}


@RestController
@RequestMapping("/consumer/feign/")
public class FeignConsumerController {

    @Autowired
    private ConsumerHttpApi consumerHttpApi;
    //http://localhost:8090/consumer/feign/{string}
  @GetMapping("{string}")
    public  String doEcho(@PathVariable String string){

      return consumerHttpApi.doecho(string);
    }
}
